import torch

a = torch.tensor([[1, 2], [3, 4]])
b = torch.tensor([[1, 2], [4, 3]])

print(torch.eq(a, b))  # equals
# tensor([[ True,  True],
#         [False, False]])

print(torch.ne(a, b))  # not equal to
# tensor([[False, False],
#         [ True,  True]])

print(torch.gt(a, b))   # greater than
# tensor([[False, False],
#         [False,  True]])

print(torch.lt(a, b))  # less than
# tensor([[False, False],
#         [ True, False]])

print(torch.ge(a, b))  # greater than or equal to
# tensor([[ True,  True],
#         [False,  True]])

print(torch.le(a, b))  # less than or equal to
# tensor([[ True,  True],
#         [ True, False]])
